﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace robotics_ex_1_3
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage: <Input File>");
                return;
            }

            if (!File.Exists(args[0]))
            {
                Console.WriteLine("The input file is missing!");
                return;
            }

            string[] inputLines = File.ReadAllLines(args[0]);

            Polygon robotPolygon = new Polygon(Convert.ToUInt32(inputLines[0]), inputLines[1]);

            Polygon roomPolygon = new Polygon(Convert.ToUInt32(inputLines[2]), inputLines[3]);

            Room room = new Room(roomPolygon);

            List<Point> freeSpacePointsList = room.calcFreeSpace(robotPolygon);

            Console.WriteLine("Number of vertices - " + freeSpacePointsList.Count);
            foreach (var point in freeSpacePointsList)
            {
                Console.WriteLine(string.Format("\t({0},{1})", point.X, point.Y));
            }
        }
    }
}
